﻿using System;
using System.Windows.Controls;

namespace DrCarDrive
{
    public class TextValidator:ValidationRule
    {
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            int odometer;
            if(Int32.TryParse(value.ToString(),out odometer))
            {
                if(odometer>0)
                {
                    return new ValidationResult(true,null);
                }
            }
            return new ValidationResult(false, "Odometer Value should be greater than 0");
        }
    }
}
